<!DOCTYPE html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../resources/common.js"></script>
<div id="log"></div>

<p>This tests dragging text from an input element into a text area element.</p>
<p>When the test is run, the follow text field should be empty:</p>
<p><input id="input" type="text" value="drag this text into the text area below" size="50"></p>
<p>And the following text area should have text in it:</p>
<p><textarea id="textarea" cols="50" rows="10"></textarea></p>

<script>
if (!window.eventSender)
    document.body.textContent = "Require window.eventSender.";

test(function() {
    var input = document.getElementById("input");
    var textarea = document.getElementById("textarea");

    input.select();
    hoverOverElement(input);
    eventSender.mouseDown();
    // Leap the event time so that mouseMove will start a new drag instead of changing selection.
    eventSender.leapForward(400);
    hoverOverElement(textarea);
    eventSender.mouseUp();

    assert_equals(input.value, "");
    assert_equals(textarea.value, "drag this text into the text area below");
}, "Test to drag INPUT text to TEXTAREA.");
</script>
</body>
